﻿Imports System.Runtime.InteropServices

Module UI
    Public Sub FormatDataGrid(ByRef dgv As DataGridView)
        dgv.AllowUserToAddRows = False
        dgv.AllowUserToDeleteRows = False
        dgv.ReadOnly = True
        dgv.RowHeadersVisible = False
        dgv.AllowUserToResizeRows = False
        dgv.EnableHeadersVisualStyles = False
        'dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(67, 96, 156)
        dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(67, 96, 156) 'Color.WhiteSmoke
        'dgv.AlternatingRowsDefaultCellStyle.BackColor = My.Settings.DataGridViewAlternativeColor
        dgv.CellBorderStyle = DataGridViewCellBorderStyle.None
        dgv.BorderStyle = BorderStyle.FixedSingle
        'dgv.RowTemplate.Height = My.Settings.DataGridViweRowHeight
        dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        dgv.ColumnHeadersHeight = 35
        dgv.MultiSelect = False
        dgv.BackgroundColor = Color.WhiteSmoke
        dgv.ColumnHeadersDefaultCellStyle.Font = New System.Drawing.Font("Californian FB", 12, FontStyle.Bold)
        dgv.DefaultCellStyle.Font = My.Settings.DataGridViweFont
        dgv.DefaultCellStyle.SelectionBackColor = Color.Goldenrod
        dgv.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke
    End Sub
    Public Sub FormatTapControl(ByRef tap As TabControl)
        tap.Appearance = TabAppearance.FlatButtons
        tap.Dock = DockStyle.Fill
        tap.Font = New System.Drawing.Font("Khmer OS Siemreap", 11.25, FontStyle.Bold)
        tap.ItemSize = New Size(130, 40)
        'tap.Padding = New System.Drawing.Point(6, 3)
        tap.SizeMode = TabSizeMode.Fixed
    End Sub

    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lParam As String) As Int32
    End Function

    Public Sub SetPlaceHolder(ByRef textbox As Object, Optional ByVal text As String = "ស្វែងរក")
        SendMessage(textbox.Handle, &H1501, 0, text)
    End Sub

End Module
